<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
		<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
		<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../../JS/common.js"></script>
	</head>

	<body style="padding: 0px;">
		<div class="easyui-layout" style="width:100%;height:600px;">
			<div data-options="region:'north'" style="height: 90px;">
				<div id="p" class="easyui-panel" title="查询" style="height: 100%;width: 100%;padding: 10px;">
					<table cellspacing="4">
						<tr>
							<td>操作模块</td>
							<td><input class="easyui-combobox" name="LOG_NAME" id="search_module" /></td>
							<td>操作类型</td>
							<td><input class="easyui-combobox" name="LOG_CTRL" id="search_operate" /></td>
							<td>操作开始时间</td>
							<td><input class="easyui-datebox" name="LOG_TIME_START" id="search_begin_time" /></td>
							<td>操作结束时间</td>
							<td><input class="easyui-datebox" name="LOG_TIME_END" id="search_end_time" /></td>
							<td>
								<a href="#" class="easyui-linkbutton" onclick="doSearch()" data-options="iconCls:'icon-search'" style="width:80px;">查询</a>
							</td>
						</tr>
					</table>
				</div>
			</div>
			<div data-options="region:'center'">
				<table id="dg" class="table_style" style="width: 100%;">
				</table>
			</div>
		</div>
		<div id="toolbar"></div>
	</body>
	<script type="text/javascript">
		
		var content = ""; 
		content = AddToolBar(TOOLBAR_REDO);
		$("#toolbar").append(content); 
	
		getModule();
		getOperate();
		
		function getModule() {
			var _url = RemoteLinkAddress + '/log/getlogname.do';
			var state = [];
			$.ajax({
				type: "get",
				url: _url,
				dataType: "json",
				success: function(result) {
					for(var i = 0;i<result.length;i++){
						var s = new Object();
						s.value = result[i];
						s.text = result[i];
						state[i] = s;
					}
					$("#search_module").combobox({
						data:state,
						valueField: 'value',
						textField: 'text'
					});
				}
			});
		}
		
		function getOperate(){
			var _url = RemoteLinkAddress + '/log/getlogctrl.do';
			var state = [];
			$.ajax({
				type: "get",
				url: _url,
				dataType: "json",
				success: function(result) {
					for(var i = 0;i<result.length;i++){
						var s = new Object();
						s.value = result[i];
						s.text = result[i];
						state[i] = s;
					}
					$("#search_operate").combobox({
						data:state,
						valueField: 'value',
						textField: 'text'
					});
				}
			});
		}
		
		function doSearch() {
			var searchCondition = "";
			if($("#search_module").combobox("getValue").length != 0) {
				searchCondition = "LOG_NAME=" + encodeURI($("#search_module").combobox("getValue"));
			}
			if($("#search_operate").combobox("getValue").length != 0) {
				if(searchCondition == "") {
					searchCondition = "LOG_CTRL=" + $("#search_operate").combobox("getValue");
				} else {
					searchCondition = searchCondition + "&LOG_CTRL=" + $("#search_operate").combobox("getValue");
				}
			}
			if($("#search_begin_time").datebox("getValue").length != 0) {
				if(searchCondition == "") {
					searchCondition = "LOG_TIME_START=" + $("#search_begin_time").datebox("getValue");
				} else {
					searchCondition = searchCondition + "&LOG_TIME_START=" + $("#search_begin_time").datebox("getValue");
				}
			}
			if($("#search_end_time").datebox("getValue").length != 0) {
				if(searchCondition == "") {
					searchCondition = "LOG_TIME_END=" + $("#search_end_time").datebox("getValue");
				} else {
					searchCondition = searchCondition + "&LOG_TIME_END=" + $("#search_end_time").datebox("getValue");
				}
			}
			_url = RemoteLinkAddress + '/log/list.do?' + searchCondition;
			$('#dg').datagrid('options').url = _url;
			$('#dg').datagrid('reload');
		}
		
		function redodata(){
			checkAllData("/log/list.do");
		}

		$('#dg').datagrid({
			url: RemoteLinkAddress + '/log/list.do',
			toolbar: '#toolbar',
			method: 'get',
			pagination: 'true',
			singleSelect: 'true',
			rownumbers: 'true',
			autoRowHeight: 'true',
			fitColumns: 'false',
			height: 350,
			columns: [
				[{
					field: 'ID',
					title: 'ID',
					width: '0%',
					align: 'center'
				}, {
					field: 'LOG_NAME',
					title: '模块名称',
					width: '11%',
					align: 'center'
				}, {
					field: 'LOG_TIME',
					title: '操作时间',
					width: '20%',
					align: 'center'
				}, {
					field: 'LOG_MAN',
					title: '操作人',
					width: '15%',
					align: 'center'
				}, {
					field: 'LOG_CTRL',
					title: '操作类型',
					width: '20%',
					align: 'center'
				}, {
					field: 'LOG_CONTENT',
					title: '日志内容',
					id:'log',
					width: '30%',
					align: 'center'
				}]
			],
			onDblClickRow:function(index,field){
				$.messager.alert('详细内容',field.LOG_CONTENT);
			}
		});
		$('#dg').datagrid('hideColumn', 'ID');
	</script>

</html>